* Figure 1 *
use "D:\Dropbox\Surge_rhetoric\Atkinson grant\Study designs\Science\KK_science_models_exp1.dta", clear

* Rely on Models Panel *
gen n = _n
gen diff = .
gen l = .
gen u = .
gen sediff = .
gen group = .
gen treatment = .

ttest rely_models_lots if model_control==1|model_dem_crit==1, by(model_dem_crit)
replace diff = r(mu_2)-r(mu_1) if n == 1
replace sediff = r(se) if n == 1
replace group = 3 if n == 1
replace treatment = 6 if n == 1

ttest rely_models_lots if model_control==1 & dem3 == 1|model_dem_crit==1 & dem3 == 1, by(model_dem_crit)
replace diff = r(mu_2)-r(mu_1) if n == 2
replace sediff = r(se) if n == 2
replace group = 2 if n == 2
replace treatment = 6 if n == 2

ttest rely_models_lots if model_control==1 & gop3 == 1|model_dem_crit==1 & gop3 == 1, by(model_dem_crit)
replace diff = r(mu_2)-r(mu_1) if n == 3
replace sediff = r(se) if n == 3
replace group = 1 if n == 3
replace treatment = 6 if n == 3

ttest rely_models_lots if model_control==1|model_gop_crit==1, by(model_gop_crit)
replace diff = r(mu_2)-r(mu_1) if n == 4
replace sediff = r(se) if n == 4
replace group = 3 if n == 4
replace treatment = 5 if n == 4

ttest rely_models_lots if model_control==1 & dem3 == 1|model_gop_crit==1 & dem3 == 1, by(model_gop_crit)
replace diff = r(mu_2)-r(mu_1) if n == 5
replace sediff = r(se) if n == 5
replace group = 2 if n == 5
replace treatment = 5 if n == 5

ttest rely_models_lots if model_control==1 & gop3 == 1|model_gop_crit==1 & gop3 == 1, by(model_gop_crit)
replace diff = r(mu_2)-r(mu_1) if n == 6
replace sediff = r(se) if n == 6
replace group = 1 if n == 6
replace treatment = 5 if n == 6

ttest rely_models_lots if model_control==1|model_dem_pro==1, by(model_dem_pro)
replace diff = r(mu_2)-r(mu_1) if n == 7
replace sediff = r(se) if n == 7
replace group = 3 if n == 7
replace treatment = 4 if n == 7

ttest rely_models_lots if model_control==1 & dem3 == 1|model_dem_pro==1 & dem3 == 1, by(model_dem_pro)
replace diff = r(mu_2)-r(mu_1) if n == 8
replace sediff = r(se) if n == 8
replace group = 2 if n == 8
replace treatment = 4 if n == 8

ttest rely_models_lots if model_control==1 & gop3 == 1|model_dem_pro==1 & gop3 == 1, by(model_dem_pro)
replace diff = r(mu_2)-r(mu_1) if n == 9
replace sediff = r(se) if n == 9
replace group = 1 if n == 9
replace treatment = 4 if n == 9

ttest rely_models_lots if model_control==1|model_gop_pro==1, by(model_gop_pro)
replace diff = r(mu_2)-r(mu_1) if n == 10
replace sediff = r(se) if n == 10
replace group = 3 if n == 10
replace treatment = 3 if n == 10

ttest rely_models_lots if model_control==1 & dem3 == 1|model_gop_pro==1 & dem3 == 1, by(model_gop_pro)
replace diff = r(mu_2)-r(mu_1) if n == 11
replace sediff = r(se) if n == 11
replace group = 2 if n == 11
replace treatment = 3 if n == 11

ttest rely_models_lots if model_control==1 & gop3 == 1|model_gop_pro==1 & gop3 == 1, by(model_gop_pro)
replace diff = r(mu_2)-r(mu_1) if n == 12
replace sediff = r(se) if n == 12
replace group = 1 if n == 12
replace treatment = 3 if n == 12

ttest rely_models_lots if model_control==1|model_both_crit==1, by(model_both_crit)
replace diff = r(mu_2)-r(mu_1) if n == 13
replace sediff = r(se) if n == 13
replace group = 3 if n == 13
replace treatment = 2 if n == 13

ttest rely_models_lots if model_control==1 & dem3 == 1|model_both_crit==1 & dem3 == 1, by(model_both_crit)
replace diff = r(mu_2)-r(mu_1) if n == 14
replace sediff = r(se) if n == 14
replace group = 2 if n == 14
replace treatment = 2 if n == 14

ttest rely_models_lots if model_control==1 & gop3 == 1|model_both_crit==1 & gop3 == 1, by(model_both_crit)
replace diff = r(mu_2)-r(mu_1) if n == 15
replace sediff = r(se) if n == 15
replace group = 1 if n == 15
replace treatment = 2 if n == 15

ttest rely_models_lots if model_control==1|model_both_pro==1, by(model_both_pro)
replace diff = r(mu_2)-r(mu_1) if n == 16
replace sediff = r(se) if n == 16
replace group = 3 if n == 16
replace treatment = 1 if n == 16

ttest rely_models_lots if model_control==1 & dem3 == 1|model_both_pro==1 & dem3 == 1, by(model_both_pro)
replace diff = r(mu_2)-r(mu_1) if n == 17
replace sediff = r(se) if n == 17
replace group = 2 if n == 17
replace treatment = 1 if n == 17

ttest rely_models_lots if model_control==1 & gop3 == 1|model_both_pro==1 & gop3 == 1, by(model_both_pro)
replace diff = r(mu_2)-r(mu_1) if n == 18
replace sediff = r(se) if n == 18
replace group = 1 if n == 18
replace treatment = 1 if n == 18

replace l = diff-1.64*(sediff)
replace u = diff+1.64*(sediff)

gen x = _n
recode x (18=1) (17=2) (16=3) (15=4) (14=5) (13=6) (12=7) (11=8) (10=9) (9=10) (8=11) (7=12) (6=13) (5=14) (4=15) (3=16)(2=17) (1=18)
replace x = . if x >18
replace x = x+2 if x >=4
replace x = x+2 if x >=9
replace x = x+2 if x >=14
replace x = x+2 if x >=19
replace x = x+2 if x >=24

separate diff, by(group)
separate u, by(group)
separate l, by(group)

twoway (dot  diff1 x, horizontal ndots(0) dcolor(white) symbol(triangle) color(black)) ///
(dot  diff2 x, horizontal ndots(0) dcolor(white) symbol(square) color(black)) ///
(dot  diff3 x, horizontal ndots(0) dcolor(white) symbol(circle) color(black)) ///
(rcap u1 l1 x, horizontal color(gs7)) (rcap u2 l2 x, horizontal color(gs12)) (rcap u3 l3 x, horizontal color(black)) , yti("") graphregion(color(white)) ///
xlabel(-.2 "-20%"  -.1 "-10%" 0 "0%" .1 "10%" .2 "20%" ) xline(0) xtitle(" " "Change in support") ///
ylabel(2 "Bipartisan support" 7 "Bipartisan criticism" 12 "Rep support" 17 "Dem support" 22 "Rep criticism" 27 "Dem criticism"  , angle(0)) /// 
ti("Strongly support use of Covid-19 models" " ", size(medium)) ///
legend(order(3 "All" 2 "Democrats" 1 "Republicans") size(small) keygap(0) cols(3)) saving(party_covid.gph, replace)

* General Science Score *
use "D:\Dropbox\Surge_rhetoric\Atkinson grant\Study designs\Science\KK_science_models_exp1.dta", clear


gen n = _n
gen diff = .
gen l = .
gen u = .
gen sediff = .
gen group = .
gen treatment = .

* Generate positive science attitudes additive index *
gen sci_not_biased = sci_bias
recode sci_not_biased (1=0) (0=1)
gen pos_sci = sci_con_lots+sci_not_biased+sci_role


ttest pos_sci if model_control==1|model_dem_crit==1, by(model_dem_crit)
replace diff = r(mu_2)-r(mu_1) if n == 1
replace sediff = r(se) if n == 1
replace group = 3 if n == 1
replace treatment = 6 if n == 1

ttest pos_sci if model_control==1 & dem3 == 1|model_dem_crit==1 & dem3 == 1, by(model_dem_crit)
replace diff = r(mu_2)-r(mu_1) if n == 2
replace sediff = r(se) if n == 2
replace group = 2 if n == 2
replace treatment = 6 if n == 2

ttest pos_sci if model_control==1 & gop3 == 1|model_dem_crit==1 & gop3 == 1, by(model_dem_crit)
replace diff = r(mu_2)-r(mu_1) if n == 3
replace sediff = r(se) if n == 3
replace group = 1 if n == 3
replace treatment = 6 if n == 3

ttest pos_sci if model_control==1|model_gop_crit==1, by(model_gop_crit)
replace diff = r(mu_2)-r(mu_1) if n == 4
replace sediff = r(se) if n == 4
replace group = 3 if n == 4
replace treatment = 5 if n == 4

ttest pos_sci if model_control==1 & dem3 == 1|model_gop_crit==1 & dem3 == 1, by(model_gop_crit)
replace diff = r(mu_2)-r(mu_1) if n == 5
replace sediff = r(se) if n == 5
replace group = 2 if n == 5
replace treatment = 5 if n == 5

ttest pos_sci if model_control==1 & gop3 == 1|model_gop_crit==1 & gop3 == 1, by(model_gop_crit)
replace diff = r(mu_2)-r(mu_1) if n == 6
replace sediff = r(se) if n == 6
replace group = 1 if n == 6
replace treatment = 5 if n == 6

ttest pos_sci if model_control==1|model_dem_pro==1, by(model_dem_pro)
replace diff = r(mu_2)-r(mu_1) if n == 7
replace sediff = r(se) if n == 7
replace group = 3 if n == 7
replace treatment = 4 if n == 7

ttest pos_sci if model_control==1 & dem3 == 1|model_dem_pro==1 & dem3 == 1, by(model_dem_pro)
replace diff = r(mu_2)-r(mu_1) if n == 8
replace sediff = r(se) if n == 8
replace group = 2 if n == 8
replace treatment = 4 if n == 8

ttest pos_sci if model_control==1 & gop3 == 1|model_dem_pro==1 & gop3 == 1, by(model_dem_pro)
replace diff = r(mu_2)-r(mu_1) if n == 9
replace sediff = r(se) if n == 9
replace group = 1 if n == 9
replace treatment = 4 if n == 9

ttest pos_sci if model_control==1|model_gop_pro==1, by(model_gop_pro)
replace diff = r(mu_2)-r(mu_1) if n == 10
replace sediff = r(se) if n == 10
replace group = 3 if n == 10
replace treatment = 3 if n == 10

ttest pos_sci if model_control==1 & dem3 == 1|model_gop_pro==1 & dem3 == 1, by(model_gop_pro)
replace diff = r(mu_2)-r(mu_1) if n == 11
replace sediff = r(se) if n == 11
replace group = 2 if n == 11
replace treatment = 3 if n == 11

ttest pos_sci if model_control==1 & gop3 == 1|model_gop_pro==1 & gop3 == 1, by(model_gop_pro)
replace diff = r(mu_2)-r(mu_1) if n == 12
replace sediff = r(se) if n == 12
replace group = 1 if n == 12
replace treatment = 3 if n == 12

ttest pos_sci if model_control==1|model_both_crit==1, by(model_both_crit)
replace diff = r(mu_2)-r(mu_1) if n == 13
replace sediff = r(se) if n == 13
replace group = 3 if n == 13
replace treatment = 2 if n == 13

ttest pos_sci if model_control==1 & dem3 == 1|model_both_crit==1 & dem3 == 1, by(model_both_crit)
replace diff = r(mu_2)-r(mu_1) if n == 14
replace sediff = r(se) if n == 14
replace group = 2 if n == 14
replace treatment = 2 if n == 14

ttest pos_sci if model_control==1 & gop3 == 1|model_both_crit==1 & gop3 == 1, by(model_both_crit)
replace diff = r(mu_2)-r(mu_1) if n == 15
replace sediff = r(se) if n == 15
replace group = 1 if n == 15
replace treatment = 2 if n == 15

ttest pos_sci if model_control==1|model_both_pro==1, by(model_both_pro)
replace diff = r(mu_2)-r(mu_1) if n == 16
replace sediff = r(se) if n == 16
replace group = 3 if n == 16
replace treatment = 1 if n == 16

ttest pos_sci if model_control==1 & dem3 == 1|model_both_pro==1 & dem3 == 1, by(model_both_pro)
replace diff = r(mu_2)-r(mu_1) if n == 17
replace sediff = r(se) if n == 17
replace group = 2 if n == 17
replace treatment = 1 if n == 17

ttest pos_sci if model_control==1 & gop3 == 1|model_both_pro==1 & gop3 == 1, by(model_both_pro)
replace diff = r(mu_2)-r(mu_1) if n == 18
replace sediff = r(se) if n == 18
replace group = 1 if n == 18
replace treatment = 1 if n == 18

replace l = diff-1.64*(sediff)
replace u = diff+1.64*(sediff)

gen x = _n
recode x (18=1) (17=2) (16=3) (15=4) (14=5) (13=6) (12=7) (11=8) (10=9) (9=10) (8=11) (7=12) (6=13) (5=14) (4=15) (3=16)(2=17) (1=18)
replace x = . if x >18
replace x = x+2 if x >=4
replace x = x+2 if x >=9
replace x = x+2 if x >=14
replace x = x+2 if x >=19
replace x = x+2 if x >=24

separate diff, by(group)
separate u, by(group)
separate l, by(group)

twoway (dot  diff1 x, horizontal ndots(0) dcolor(white) symbol(triangle) color(black)) ///
(dot  diff2 x, horizontal ndots(0) dcolor(white) symbol(square) color(black)) ///
(dot  diff3 x, horizontal ndots(0) dcolor(white) symbol(circle) color(black)) ///
(rcap u1 l1 x, horizontal color(gs7)) (rcap u2 l2 x, horizontal color(gs12)) (rcap u3 l3 x, horizontal color(black)) , yti("") graphregion(color(white)) ///
xlabel(-.3 -.2 -.1 0 .1 .2 .3) xline(0) xtitle(" " "Change in score") ///
ylabel(2 "Bipartisan support" 7 "Bipartisan criticism" 12 "Rep support" 17 "Dem support" 22 "Rep criticism" 27 "Dem criticism"  , angle(0)) /// 
ti("Science support score" " ", size(medium)) ///
legend(order(3 "All" 2 "Democrats" 1 "Republicans") size(small) keygap(0) cols(3)) saving(party_science.gph, replace)

grc1leg2 party_covid.gph party_science.gph, graphregion(color(white)) rows(2) cols(1) saving("fig1.gph", replace) iscale(.7) 
gr_edit .style.editstyle declared_ysize(11) declared_xsize(8.5) editcopy
graph export KK_fig1.pdf

* Figure 2 -- Experiment 2 *

* Support Covid Models *

use "D:\Dropbox\Surge_rhetoric\Atkinson grant\Study designs\Science\KK_science_models_exp2.dta", clear

gen n = _n
gen diff = .
gen l = .
gen u = .
gen sediff = .
gen treatment = .
gen group = .

ttest rely_models_lots if model_control==1|cuomo==1, by(cuomo)
replace diff = r(mu_2)-r(mu_1) if n == 1
replace sediff = r(se) if n == 1
replace group = 3 if n == 1
replace treatment = 1 if n == 1

ttest rely_models_lots if model_control==1 & dem3 == 1|cuomo==1 & dem3 == 1, by(cuomo)
replace diff = r(mu_2)-r(mu_1) if n == 2
replace sediff = r(se) if n == 2
replace group = 2 if n == 2
replace treatment = 1 if n == 2

ttest rely_models_lots if model_control==1 & gop3 == 1 |cuomo==1 & gop3 == 1, by(cuomo)
replace diff = r(mu_2)-r(mu_1) if n == 3
replace sediff = r(se) if n == 3
replace group = 1 if n == 3
replace treatment = 1 if n == 3

ttest rely_models_lots if model_control==1|cornyn==1, by(cornyn)
replace diff = r(mu_2)-r(mu_1) if n == 4
replace sediff = r(se) if n == 4
replace group = 3 if n == 4
replace treatment = 1 if n == 4

ttest rely_models_lots if model_control==1 & dem3 == 1|cornyn==1 & dem3 == 1, by(cornyn)
replace diff = r(mu_2)-r(mu_1) if n == 5
replace sediff = r(se) if n == 5
replace group = 2 if n == 5
replace treatment = 1 if n == 5

ttest rely_models_lots if model_control==1 & gop3 == 1 |cornyn==1 & gop3 == 1, by(cornyn)
replace diff = r(mu_2)-r(mu_1) if n == 6
replace sediff = r(se) if n == 6
replace group = 1 if n == 6
replace treatment = 1 if n == 6


label define groups 1 "High Sci Know" 2 "Low Sci Know" 3 "All"
label values group groups
label define cats 3 "All" 2 "Democrats" 1 "Republicans"
label values treatment cats

replace l = diff-1.64*(sediff)
replace u = diff+1.64*(sediff)

gen x = _n
recode x  (6=1) (5=2) (4=3) (3=4) (2=5) (1=6)
replace x = . if x >6
replace x = x+2 if x >=4

separate diff, by(group)

twoway (dot  diff1 x, horizontal ndots(0) dcolor(white) symbol(triangle) color(black)) ///
(dot  diff2 x, horizontal ndots(0) dcolor(white) symbol(square) color(black)) ///
(dot  diff3 x, horizontal ndots(0) dcolor(white) symbol(circle) color(black)) ///
(rcap u l x, horizontal color(black)), yti("") graphregion(color(white)) ///
xlabel(-.3 "-30%" -.2 "-20%" -.1 "-10%" 0 "0%" .1 "10%" .2 "20%") xline(0) xti(" " "Change in Support") ///
ylabel(2 "Cornyn" 7 "Cuomo", angle(0)) /// 
ti("Strongly Support Use of Covid-19 Models" " ", size(medium)) ///
legend(order(3 "All" 2 "Democrats" 1 "Republicans") size(small) keygap(0) cols(3)) saving(modelscccovid.gph, replace)

* General Science Support *
use "D:\Dropbox\Surge_rhetoric\Atkinson grant\Study designs\Science\KK_science_models_exp2.dta", clear

* Generate positive science attitudes additive index *
gen sci_not_biased = sci_bias
recode sci_not_biased (1=0) (0=1)
gen pos_sci = sci_con_lots+sci_not_biased+sci_role

gen n = _n
gen diff = .
gen l = .
gen u = .
gen sediff = .
gen treatment = .
gen group = .

ttest pos_sci if model_control==1|cuomo==1, by(cuomo)
replace diff = r(mu_2)-r(mu_1) if n == 1
replace sediff = r(se) if n == 1
replace group = 3 if n == 1
replace treatment = 1 if n == 1

ttest pos_sci if model_control==1 & dem3 == 1|cuomo==1 & dem3 == 1, by(cuomo)
replace diff = r(mu_2)-r(mu_1) if n == 2
replace sediff = r(se) if n == 2
replace group = 2 if n == 2
replace treatment = 1 if n == 2

ttest pos_sci if model_control==1 & gop3 == 1 |cuomo==1 & gop3 == 1, by(cuomo)
replace diff = r(mu_2)-r(mu_1) if n == 3
replace sediff = r(se) if n == 3
replace group = 1 if n == 3
replace treatment = 1 if n == 3

ttest pos_sci if model_control==1|cornyn==1, by(cornyn)
replace diff = r(mu_2)-r(mu_1) if n == 4
replace sediff = r(se) if n == 4
replace group = 3 if n == 4
replace treatment = 1 if n == 4

ttest pos_sci if model_control==1 & dem3 == 1|cornyn==1 & dem3 == 1, by(cornyn)
replace diff = r(mu_2)-r(mu_1) if n == 5
replace sediff = r(se) if n == 5
replace group = 2 if n == 5
replace treatment = 1 if n == 5

ttest pos_sci if model_control==1 & gop3 == 1 |cornyn==1 & gop3 == 1, by(cornyn)
replace diff = r(mu_2)-r(mu_1) if n == 6
replace sediff = r(se) if n == 6
replace group = 1 if n == 6
replace treatment = 1 if n == 6


label define groups 1 "High Sci Know" 2 "Low Sci Know" 3 "All"
label values group groups
label define cats 3 "All" 2 "Democrats" 1 "Republicans"
label values treatment cats

replace l = diff-1.64*(sediff)
replace u = diff+1.64*(sediff)

gen x = _n
recode x  (6=1) (5=2) (4=3) (3=4) (2=5) (1=6)
replace x = . if x >6
replace x = x+2 if x >=4

separate diff, by(group)

twoway (dot  diff1 x, horizontal ndots(0) dcolor(white) symbol(triangle) color(black)) ///
(dot  diff2 x, horizontal ndots(0) dcolor(white) symbol(square) color(black)) ///
(dot  diff3 x, horizontal ndots(0) dcolor(white) symbol(circle) color(black)) ///
(rcap u l x, horizontal color(black)), yti("") graphregion(color(white)) ///
xlabel(-.5 -.4 -.3 -.2 -.1 0 .1  .2 ) xline(0) xti(" " "Change in Score") ///
ylabel(2 "Cornyn" 7 "Cuomo", angle(0)) /// 
ti("Science Support Score" " ", size(medium)) ///
legend(order(3 "All" 2 "Democrats" 1 "Republicans") size(small) keygap(0) cols(3)) saving(modelsccscience.gph, replace)

grc1leg2 modelscccovid.gph modelsccscience.gph, graphregion(color(white)) rows(2) cols(1) saving("fig2.gph", replace) iscale(.7) 
gr_edit .style.editstyle declared_ysize(11) declared_xsize(8.5) editcopy
graph export KK_fig2.pdf

* Figure 3 -- Experiment 3 *
use "D:\Dropbox\Surge_rhetoric\Atkinson grant\Study designs\Science\KK_science_models_exp3.dta", clear

* Generate positive science attitudes additive index *
gen sci_not_biased = sci_bias
recode sci_not_biased (1=0) (0=1)
gen pos_sci = sci_con_lots+sci_not_biased+sci_role

gen n = _n
gen diff = .
gen l = .
gen u = .
gen sediff = .
gen category_action = .
gen headline = .

ttest rely_models_lots if point==1|reversal==1, by(reversal)
replace diff = r(mu_2)-r(mu_1) if n == 1
replace sediff = r(se) if n == 1
replace headline = 4 if n == 1
replace category_action = 3 if n == 1

ttest rely_models_lots if point==1|range==1, by(range)
replace diff = r(mu_2)-r(mu_1) if n == 2
replace sediff = r(se) if n == 2
replace headline = 4 if n == 2
replace category_action = 2 if n == 2

ttest pos_sci if point==1|reversal==1, by(reversal)
replace diff = r(mu_2)-r(mu_1) if n == 3
replace sediff = r(se) if n == 3
replace headline = 3 if n == 3
replace category_action = 3 if n == 3

ttest pos_sci if point==1|range==1, by(range)
replace diff = r(mu_2)-r(mu_1) if n == 4
replace sediff = r(se) if n == 4
replace headline = 3 if n == 4
replace category_action = 2 if n == 4

label define head 2 "General Support for Science" 1 "Support for Covid Models"
label values headline head
label define cats 3 "Reversal" 2 "Range" 
label values category_action cats

replace l = diff-1.64*(sediff)
replace u = diff+1.64*(sediff)

gen x = _n
recode x (4=1) (3=2) (2=3) (1=4)
replace x = . if x >4
replace x = 1.45 if x == 1
replace x = 1.55 if x == 2
replace x = 1.95 if x == 3
replace x = 2.05 if x == 4
*replace x = x+1 if x >=3


separate diff, by(category_action)

* Combined *
twoway (dot  diff2 x, horizontal ndots(0) dcolor(white) symbol(square) color(black)) ///
(dot  diff3 x, horizontal ndots(0) dcolor(white) symbol(circle) color(black)) ///
(rcap u l x, horizontal color(black)), yti("") graphregion(color(white)) ///
xlabel(-.2 "-20%" -.1 "-10%" 0 "0%" .1 "10%" .2 "20%") xline(0) ///
yscale(range(1.3 2.2)) ylabel( 1.5 "Science Support Score" 2 "Support Covid Models" , angle(0)) /// 
legend(order(2 "Reversal" 1 "Range") size(medsmall) keygap(0) cols(3))

drop x
gen x = _n
recode x (4=1) (3=2) (2=3) (1=4)
replace x = . if x >4


* Support Covid *
twoway (dot  diff2 x if x>2, horizontal ndots(0) dcolor(white) symbol(circle) color(black)) ///
(dot  diff3 x if x>2, horizontal ndots(0) dcolor(white) symbol(circle) color(black)) ///
(rcap u l x if x>2, horizontal color(black)), yti("") graphregion(color(white)) ///
xlabel(-.2 "-20%" -.1 "-10%" 0 "0%" .1 "10%" .2 "20%") xline(0) ///
yscale(range(2.5 4.5)) ylabel( 3 "Range" 4 "Reversal" , angle(0)) ti("Strongly Support Use of Covid-19 Models" " ", size(medium)) legend(off) ///
xtitle(" " "Change in Support") saving(covid_rr_main.gph, replace)

twoway (dot  diff2 x if x<3, horizontal ndots(0) dcolor(white) symbol(circle) color(black)) ///
(dot  diff3 x if x<3, horizontal ndots(0) dcolor(white) symbol(circle) color(black)) ///
(rcap u l x if x<3, horizontal color(black)), yti("") graphregion(color(white)) ///
xlabel(-.3 -.2 -.1 0 .1) xline(0) ///
yscale(range(.5 2.5)) ylabel( 1 "Range" 2 "Reversal" , angle(0)) ti("General Science Support Score" " ", size(medium)) legend(off) ///
xtitle(" " "Change in Score") saving(science_rr_main.gph, replace)

graph combine covid_rr_main.gph science_rr_main.gph, graphregion(color(white)) rows(2) cols(1) xsize(8.5) ysize(11)
graph export KK_fig3.pdf

* Figure 4 -- Experiment 4 *
use "D:\Dropbox\Surge_rhetoric\Atkinson grant\Study designs\Science\KK_science_models_exp4.dta", clear
gen n = _n
gen diff = .
gen l = .
gen u = .
gen sediff = .
gen category_action = .
gen headline = .

* Generate positive science attitudes additive index *
gen sci_not_biased = sci_bias
recode sci_not_biased (1=0) (0=1)
gen pos_sci = sci_con_lots+sci_not_biased+sci_role

ttest rely_models_lots if control_model==1|uncertainty==1, by(uncertainty)
replace diff = r(mu_2)-r(mu_1) if n == 1
replace sediff = r(se) if n == 1
replace headline = 4 if n == 1
replace category_action = 3 if n == 1

ttest rely_models_lots if control_model==1|sacrifice==1, by(sacrifice)
replace diff = r(mu_2)-r(mu_1) if n == 2
replace sediff = r(se) if n == 2
replace headline = 4 if n == 2
replace category_action = 2 if n == 2

ttest rely_models_lots if control_model==1|both==1, by(both)
replace diff = r(mu_2)-r(mu_1) if n == 3
replace sediff = r(se) if n == 3
replace headline = 4 if n == 3
replace category_action = 1 if n == 3

ttest pos_sci if control_model==1|uncertainty==1, by(uncertainty)
replace diff = r(mu_2)-r(mu_1) if n == 4
replace sediff = r(se) if n == 4
replace headline = 3 if n == 4
replace category_action = 3 if n == 4

ttest pos_sci if control_model==1|sacrifice==1, by(sacrifice)
replace diff = r(mu_2)-r(mu_1) if n == 5
replace sediff = r(se) if n == 5
replace headline = 3 if n == 5
replace category_action = 2 if n == 5

ttest pos_sci if control_model==1|both==1, by(both)
replace diff = r(mu_2)-r(mu_1) if n == 6
replace sediff = r(se) if n == 6
replace headline = 3 if n == 6
replace category_action = 1 if n == 6

label define cats 3 "Weaponizing" 2 "Catastrophizing" 1 "Both"
label values category_action cats

replace l = diff-1.64*(sediff)
replace u = diff+1.64*(sediff)


separate diff, by(category_action)

gen x = _n
recode x (6=1) (5=2) (4=3) (3=4) (2=5) (1=6)
replace x = . if x >6

* Support Covid *
twoway (dot  diff1 x if x>3, horizontal ndots(0) dcolor(white) symbol(circle) color(black)) ///
(dot  diff2 x if x>3, horizontal ndots(0) dcolor(white) symbol(circle) color(black)) ///
(dot  diff3 x if x>3, horizontal ndots(0) dcolor(white) symbol(circle) color(black)) ///
(rcap u l x if x>3, horizontal color(black)), yti("") graphregion(color(white)) ///
xlabel(-.1 "-10%" 0 "0%" .1 "10%" .2 "20%" .3 "30%") xline(0) ///
yscale(range(3.5 6.5)) ylabel( 4 "Both" 5 "Catastrophizing" 6 "Weaponizing" , angle(0)) ti("Strongly Support Use of Covid-19 Models" " ", size(medium)) legend(off) ///
xtitle(" " "Change in Support") saving(covid_wcb_main.gph, replace)

* Science Support Score *
twoway (dot  diff1 x if x<4, horizontal ndots(0) dcolor(white) symbol(circle) color(black)) ///
(dot  diff2 x if x<4, horizontal ndots(0) dcolor(white) symbol(circle) color(black)) ///
(dot  diff3 x if x<4, horizontal ndots(0) dcolor(white) symbol(circle) color(black)) ///
(rcap u l x if x<4, horizontal color(black)), yti("") graphregion(color(white)) ///
xlabel(-.1 0 .1 .2 .3) xline(0) ///
yscale(range(.5 3.5)) ylabel( 1 "Both" 2 "Catastrophizing" 3 "Weaponizing"  , angle(0)) ti("General Science Support Score" " ", size(medium)) legend(off) ///
xtitle(" " "Change in Score") saving(science_wcb_main.gph, replace)

graph combine covid_wcb_main.gph science_wcb_main.gph, graphregion(color(white)) rows(2) cols(1) xsize(8.5) ysize(11) iscale(.7)
graph export KK_fig4.pdf

* Figure 5 -- Experiment 5 *
use "D:\Dropbox\Surge_rhetoric\Atkinson grant\Study designs\Science\KK_science_models_exp5.dta", clear

* Generate positive science attitudes additive index *
gen sci_not_biased = sci_bias
recode sci_not_biased (1=0) (0=1)
gen pos_sci = sci_con_lots+sci_not_biased+sci_role

gen n = _n
gen diff = .
gen l = .
gen u = .
gen sediff = .
gen category_action = .
gen headline = .

ttest rely_models_lots if control_process==1|criticism==1, by(criticism)
replace diff = r(mu_2)-r(mu_1) if n == 1
replace sediff = r(se) if n == 1
replace headline = 4 if n == 1
replace category_action = 3 if n == 1

ttest rely_models_lots if control_process==1|speed==1, by(speed)
replace diff = r(mu_2)-r(mu_1) if n == 2
replace sediff = r(se) if n == 2
replace headline = 4 if n == 2
replace category_action = 2 if n == 2

ttest rely_models_lots if control_process==1|process==1, by(process)
replace diff = r(mu_2)-r(mu_1) if n == 3
replace sediff = r(se) if n == 3
replace headline = 4 if n == 3
replace category_action = 1 if n == 3

ttest pos_sci if control_process==1|criticism==1, by(criticism)
replace diff = r(mu_2)-r(mu_1) if n == 4
replace sediff = r(se) if n == 4
replace headline = 3 if n == 4
replace category_action = 3 if n == 4

ttest pos_sci if control_process==1|speed==1, by(speed)
replace diff = r(mu_2)-r(mu_1) if n == 5
replace sediff = r(se) if n == 5
replace headline = 3 if n == 5
replace category_action = 2 if n == 5

ttest pos_sci if control_process==1|process==1, by(process)
replace diff = r(mu_2)-r(mu_1) if n == 6
replace sediff = r(se) if n == 6
replace headline = 3 if n == 6
replace category_action = 1 if n == 6

label define cats 3 "Criticism" 2 "Speed justification" 1 "Process justification"
label values category_action cats

replace l = diff-1.64*(sediff)
replace u = diff+1.64*(sediff)
separate diff, by(category_action)

gen x = _n
recode x (6=1) (5=2) (4=3) (3=4) (2=5) (1=6)
replace x = . if x >6

* Support Covid *
twoway (dot  diff1 x if x>3, horizontal ndots(0) dcolor(white) symbol(circle) color(black)) ///
(dot  diff2 x if x>3, horizontal ndots(0) dcolor(white) symbol(circle) color(black)) ///
(dot  diff3 x if x>3, horizontal ndots(0) dcolor(white) symbol(circle) color(black)) ///
(rcap u l x if x>3, horizontal color(black)), yti("") graphregion(color(white)) ///
xlabel(-.1 "-10%" 0 "0%" .1 "10%" .2 "20%") xline(0) ///
yscale(range(3.5 6.5)) ylabel( 4 "Process" 5 "Speed" 6 "Criticism" , angle(0)) ti("Strongly Support Use of Covid-19 Models" " ", size(medium)) legend(off) ///
xtitle(" " "Change in Support") saving(covid_just_main.gph, replace)

* Science Support Score *
twoway (dot  diff1 x if x<4, horizontal ndots(0) dcolor(white) symbol(circle) color(black)) ///
(dot  diff2 x if x<4, horizontal ndots(0) dcolor(white) symbol(circle) color(black)) ///
(dot  diff3 x if x<4, horizontal ndots(0) dcolor(white) symbol(circle) color(black)) ///
(rcap u l x if x<4, horizontal color(black)), yti("") graphregion(color(white)) ///
xlabel(-.2 -.1 0 .1 .2) xline(0) ///
yscale(range(.5 3.5)) ylabel( 1 "Process" 2 "Speed" 3 "Criticism"  , angle(0)) ti("General Science Support Score" " ", size(medium)) legend(off) ///
xtitle(" " "Change in Score") saving(science_just_main.gph, replace)

graph combine covid_just_main.gph science_just_main.gph, graphregion(color(white)) rows(2) cols(1) xsize(8.5) ysize(11) iscale(.7)
graph export KK_fig5.pdf

* Figure 6 -- experiments 3 and 4 *
use "D:\Dropbox\Surge_rhetoric\Atkinson grant\Study designs\Science\KK_science_models_exp3.dta", clear
gen sci_not_biased = sci_bias
recode sci_not_biased (1=0) (0=1)
gen pos_sci = sci_con_lots+sci_not_biased+sci_role

* Support Covid Models*
logit rely_models_lots i.reversal##c.sci_know i.range##c.sci_know 
margins, at(sci_know=(0(1)8) reversal=(0(1)1) range=(0)) vsquish atmeans
marginsplot, x(sci_know)  recast(line) 
marginsplot, recast(line) recastci(rarea) level(90) graphregion(color(white))  plot1opts(lpattern(solid)) plot2opts(lpattern(dash)) ytitle("Support Covid Models" " ") xtitle(" " "Science Knowledge") xlabel(0 "0" 1 "1" 2 "2" 3 "3" 4 "4" 5 "5" 6 "6" 7 "7" 8 "8") title("Reversal") legend(order(3 "Control" 4 "Treatment")) saving(covid_reversal.gph, replace)

logit rely_models_lots i.reversal##c.sci_know i.range##c.sci_know 
margins, at(sci_know=(0(1)8) range=(0(1)1) reversal=(0)) vsquish atmeans
marginsplot, x(sci_know)  recast(line) 
marginsplot, recast(line) recastci(rarea) level(90) graphregion(color(white))  plot1opts(lpattern(solid)) plot2opts(lpattern(dash)) ytitle("Support Covid Models" " ") xtitle(" " "Science Knowledge") xlabel(0 "0" 1 "1" 2 "2" 3 "3" 4 "4" 5 "5" 6 "6" 7 "7" 8 "8") title("Range") legend(order(3 "Control" 4 "Treatment")) saving(covid_range.gph, replace)

* Science Support Score *
reg pos_sci i.reversal##c.sci_know i.range##c.sci_know 
margins, at(sci_know=(0(1)8) reversal=(0(1)1) range=(0)) vsquish atmeans
marginsplot, x(sci_know)  recast(line) 
marginsplot, recast(line) recastci(rarea) level(90) graphregion(color(white))  plot1opts(lpattern(solid)) plot2opts(lpattern(dash)) ytitle("Science Support Score" " ") xtitle(" " "Science Knowledge") xlabel(0 "0" 1 "1" 2 "2" 3 "3" 4 "4" 5 "5" 6 "6" 7 "7" 8 "8") title("Reversal") legend(order(3 "Control" 4 "Treatment")) saving(science_reversal.gph, replace)

reg pos_sci i.reversal##c.sci_know i.range##c.sci_know 
margins, at(sci_know=(0(1)8) range=(0(1)1) reversal=(0)) vsquish atmeans
marginsplot, x(sci_know)  recast(line) 
marginsplot, recast(line) recastci(rarea) level(90) graphregion(color(white))  plot1opts(lpattern(solid)) plot2opts(lpattern(dash)) xtitle(" " "Science Knowledge") ytitle("Science Support Score" " ") xlabel(0 "0" 1 "1" 2 "2" 3 "3" 4 "4" 5 "5" 6 "6" 7 "7" 8 "8") title("Range") legend(order(3 "Control"  4 "Treatment")) saving(science_range.gph, replace)

use "D:\Dropbox\Surge_rhetoric\Atkinson grant\Study designs\Science\KK_science_models_exp4.dta", clear
gen sci_not_biased = sci_bias
recode sci_not_biased (1=0) (0=1)
gen pos_sci = sci_con_lots+sci_not_biased+sci_role

* Support Covid Models*
logit rely_models_lots i.uncertainty##c.sci_know i.sacrifice##c.sci_know i.both##c.sci_know 
margins, at(sci_know=(0(1)8) uncertainty=(0(1)1) sacrifice=(0) both=(0)) vsquish atmeans
marginsplot, x(sci_know)  recast(line) 
marginsplot, recast(line) recastci(rarea) level(90) plot1opts(lpattern(solid)) plot2opts(lpattern(dash)) xtitle(" " "Science Knowledge") graphregion(color(white)) ytitle("Support Covid Models" " ") xlabel(0 "0" 1 "1" 2 "2" 3 "3" 4 "4" 5 "5" 6 "6" 7 "7" 8 "8") title("Weaponizing") legend(order(3 "Control" 4 "Treatment")) saving(covid_weapon.gph, replace)

logit rely_models_lots i.uncertainty##c.sci_know i.sacrifice##c.sci_know i.both##c.sci_know 
margins, at(sci_know=(0(1)8) sacrifice=(0(1)1) uncertainty=(0) both=(0)) vsquish atmeans
marginsplot, x(sci_know)  recast(line) 
marginsplot, recast(line) recastci(rarea) level(90) plot1opts(lpattern(solid)) plot2opts(lpattern(dash)) xtitle(" " "Science Knowledge") graphregion(color(white)) ytitle("Support Covid Models" " ") xlabel(0 "0" 1 "1" 2 "2" 3 "3" 4 "4" 5 "5" 6 "6" 7 "7" 8 "8") title("Catastrophizing") legend(order(3 "Control" 4 "Treatment")) saving(covid_cat.gph, replace)

logit rely_models_lots i.uncertainty##c.sci_know i.sacrifice##c.sci_know i.both##c.sci_know 
margins, at(sci_know=(0(1)8) both=(0(1)1) uncertainty=(0) sacrifice=(0)) vsquish atmeans
marginsplot, x(sci_know)  recast(line) 
marginsplot, recast(line) recastci(rarea) level(90) plot1opts(lpattern(solid)) plot2opts(lpattern(dash)) xtitle(" " "Science Knowledge") graphregion(color(white)) ytitle("Support Covid Models" " ") xlabel(0 "0" 1 "1" 2 "2" 3 "3" 4 "4" 5 "5" 6 "6" 7 "7" 8 "8") title("Both") legend(order(3 "Control" 4 "Treatment")) saving(covid_both.gph, replace)

* Science Support Score *
reg pos_sci  i.uncertainty##c.sci_know i.sacrifice##c.sci_know i.both##c.sci_know 
margins, at(sci_know=(0(1)8) uncertainty=(0(1)1) sacrifice=(0) both=(0)) vsquish atmeans
marginsplot, x(sci_know)  recast(line) 
marginsplot, recast(line) recastci(rarea) level(90) plot1opts(lpattern(solid)) plot2opts(lpattern(dash)) xtitle(" " "Science Knowledge") graphregion(color(white)) ytitle("Science Support Score" " ") xlabel(0 "0" 1 "1" 2 "2" 3 "3" 4 "4" 5 "5" 6 "6" 7 "7" 8 "8") title("Weaponizing") legend(order(3 "Control" 4 "Treatment")) saving(sci_weapon.gph, replace)

reg pos_sci  i.uncertainty##c.sci_know i.sacrifice##c.sci_know i.both##c.sci_know 
margins, at(sci_know=(0(1)8) sacrifice=(0(1)1) uncertainty=(0) both=(0)) vsquish atmeans
marginsplot, x(sci_know)  recast(line) 
marginsplot, recast(line) recastci(rarea) level(90) plot1opts(lpattern(solid)) plot2opts(lpattern(dash)) xtitle(" " "Science Knowledge") graphregion(color(white)) ytitle("Science Support Score" " ") xlabel(0 "0" 1 "1" 2 "2" 3 "3" 4 "4" 5 "5" 6 "6" 7 "7" 8 "8") title("Catastrophizing") legend(order(3 "Control" 4 "Treatment")) saving(sci_cat.gph, replace)

reg pos_sci  i.uncertainty##c.sci_know i.sacrifice##c.sci_know i.both##c.sci_know 
margins, at(sci_know=(0(1)8) both=(0(1)1) uncertainty=(0) sacrifice=(0)) vsquish atmeans
marginsplot, x(sci_know)  recast(line) ///
ytitle("Science Support Score" " ")  xlabel(0 "0" 1 "1" 2 "2" 3 "3" 4 "4" 5 "5" 6 "6" 7 "7" 8 "8") xtitle(" " "Science Knowledge") title("Both") legend(order(3 "Control" 4 "Treatment")) saving(sci_both.gph, replace)
marginsplot, recast(line) recastci(rarea) level(90) graphregion(color(white)) plot1opts(lpattern(solid)) plot2opts(lpattern(dash)) ///

// create a blank graph
twoway scatteri 1 1,               ///
       msymbol(i)                  ///
       ylab("") xlab("")           ///
       ytitle("") xtitle("")       ///
       yscale(off) xscale(off)     ///
       plotregion(lpattern(blank)) graphregion(color(white)) ///
       saving(blank.gph, replace)
grc1leg2 science_reversal.gph science_range.gph blank.gph covid_weapon.gph covid_cat.gph covid_both.gph , graphregion(color(white)) iscale(.7) rows(2) cols(3)
gr_edit .plotregion1.graph3.plotregion1.style.editstyle boxstyle(shadestyle(color(none))) editcopy
gr_edit .plotregion1.graph3.plotregion1.style.editstyle boxstyle(linestyle(color(none))) editcopy
graph export KK_fig6.pdf
